package com.bwie.config;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther:${涛}
 * @Date:2024/9/4 19:16
 * @Description: RabbitMqConfig
 * @Version 1.0.0
 */
@Configuration
public class RabbitMqConfig {


    @Autowired
    RabbitTemplate rabbitTemplate;


    @Bean
    public void setRabbitTemplate(){
        rabbitTemplate.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
            @Override
            public void confirm(CorrelationData correlationData, boolean b, String s) {
                if(b) {
                    System.out.println("消费成功");
                }else{
                    System.out.println("消费失败");
                }
            }
        });
    }


}


